/*
 * p3335.cpp
 *
 *  Created on: 2013-5-28
 *      Author: zy
 */
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn = 1000;
const double eps = 1e-6;
int sig(double d)
{
	return fabs(d) < 1e-6 ? 0 : d < 0 ? -1 : 1;
}
struct Point
{
	double x, y;
	Point(double x = 0, double y = 0) :
		x(x), y(y)
	{
	}
};
typedef Point Vector;
Vector operator -(Vector a, Vector b)
{
	return Vector(a.x - b.x, a.y - b.y);
}
Vector operator *(Vector a, double p)
{
	return Vector(a.x * p, a.y * p);
}
Vector operator +(Vector a, Vector b)
{
	return Vector(a.x + b.x, a.y + b.y);
}
double cross(Vector a, Vector b)
{
	return a.x * b.y - a.y * b.x;
}
struct Line
{
	Point p;//直线上的任意一点
	Vector v;//方向向量，左边即半平面
	double ang;//极角，从x正半轴旋转到向量v所需的角
	Line()
	{
	}
	Line(Point p, Vector v) :
		p(p), v(v)
	{
		ang = atan2(v.y, v.x);
	}
	bool operator <(const Line& L) const
	{
		return ang < L.ang;
	}
};
//点p在有向直线l的左边（线上不算）
bool onLeft(Line l, Point p)
{
	return cross(l.v, p - l.p) >= 0;
}
//a,b交点唯一存在
Point getIntersection(Line a, Line b)
{
	Vector u = a.p - b.p;
	double t = cross(b.v, u) / cross(a.v, b.v);
	return a.p + a.v * t;
}
bool halfPlaneIntersection(Line *L, int n, Point * poly)
{
	sort(L, L + n);

	int first, last;
	Point p[maxn];
	Line q[maxn];
	q[first = last = 0] = L[0];
	for (int i = 1; i < n; i++)
	{
		while (first < last && !onLeft(L[i], p[last - 1]))
			last--;
		while (first < last && !onLeft(L[i], p[first]))
			first++;
		q[++last] = L[i];
		if (sig(cross(q[last].v, q[last - 1].v)) == 0)
		{
			last--;
			if (onLeft(q[last], L[i].p))
				q[last] = L[i];
		}
		if (first < last)
			p[last - 1] = getIntersection(q[last - 1], q[last]);
	}
	while (first < last && !onLeft(q[first], p[last - 1]))
		last--;
	if (last - first <= 1)
		return 0;
	return 1;
}
void calPolygon(Point *p, int n, double &area, bool &shun)
{
	p[n] = p[0];
	area = 0;
	double tmp;
	for (int i = 0; i < n; i++)
		area += p[i].x * p[i + 1].y - p[i].y * p[i + 1].x;
	area /= 2.0;
	if (shun = area < 0)
		area = -area;
}
bool calCore(Point *ps, int n)
{
	Line l[maxn];
	ps[n] = ps[0];
	bool shun;
	double area;
	calPolygon(ps, n, area, shun);
	if (shun)
		for (int i = 0; i < n; i++)
			l[i] = Line(ps[i], ps[i] - ps[i + 1]);
	else
		for (int i = 0; i < n; i++)
			l[i] = Line(ps[i], ps[i + 1] - ps[i]);
	Point pp[maxn];
	return halfPlaneIntersection(l, n, pp);
}
int main()
{
	int T;
	scanf("%d", &T);
	Point pt[110];
	while (T--)
	{
		int n;
		scanf("%d", &n);
		for (int i = 0; i < n; i++)
			scanf("%lf%lf", &pt[i].x, &pt[i].y);
		if (calCore(pt, n))
			puts("YES");
		else
			puts("NO");
	}
	return 0;
}
